]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionDownloader: Compile gsettings schemas after install
authorAndy Holmes <andrew.g.r.holmes@gmail.com>
Sun, 12 Feb 2023 21:54:07 +0000 (13:54 -0800)
committerMarge Bot <marge-bot@gnome.org>
Mon, 13 Feb 2023 00:01:08 +0000 (00:01 +0000)
After an extension is installed, run `glib-compile-schemas` on its
`schemas` directory, if it exists.

This should avoid any endianess-related issues for extensions when
running GNOME Shell on varying architectures.

Co-authored-by: Marco Trevisan (TreviƱo) <mail@3v1n0.net>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2638>

js/ui/extensionDownloader.js

index 94ba8fad5935fc990104f86ecf52b340af88cd65..b3cef41a6aedf36863366de1d0260fe26898d3da 100644 (file)
@@ -113,6 +113,24 @@ async function extractExtensionArchive(bytes, dir) {
         ['unzip', '-uod', dir.get_path(), '--', file.get_path()],
         Gio.SubprocessFlags.NONE);
     await unzip.wait_check_async(null);
+
+    const schemasPath = dir.get_child('schemas');
+    const info = await schemasPath.query_info_async(
+        Gio.FILE_ATTRIBUTE_STANDARD_TYPE,
+        Gio.FileQueryInfoFlags.NONE,
+        GLib.PRIORITY_DEFAULT,
+        null);
+
+    if (info.get_file_type() === Gio.FileType.DIRECTORY) {
+        const compileSchema = Gio.Subprocess.new(
+            ['glib-compile-schemas', '--strict', schemasPath.get_path()],
+            Gio.SubprocessFlags.NONE);
+        try {
+            await compileSchema.wait_check_async(null);
+        } catch (e) {
+            log(`Error while compiling schema for extension ${dir.get_basename()}: (${e.message})`);
+        }
+    }
 }
 
 /**